//
//  StoreViewController.m
//  NekaPrice
//
//  Created by yu on 2018/7/6.
//  Copyright © 2018年 ma c. All rights reserved.
//

#import "StoreViewController.h"
#import <WebKit/WebKit.h>
@interface StoreViewController ()<WKNavigationDelegate, UIScrollViewDelegate>

@property (nonatomic, strong)WKWebView *webView;

@end

@implementation StoreViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
//    [self.customBar showBackBtn:NO closeBtn:NO shareBtn:NO];
    [self hideNavBar];
    
    [self.view addSubview:self.webView];
    [self.webView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(0);  //self.customBar.height
        make.left.right.mas_equalTo(0);
        make.bottom.mas_equalTo(-self.bottom);
    }];
    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:FormURL(@"/gzh/mdcx/")]]];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(netWorkAvailableAction) name:@"NETWORK_AVAILABLE" object:nil];
    
    
}

- (void)netWorkAvailableAction {
    
    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:FormURL(@"/gzh/mdcx/")]]];
    
}


- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(null_unspecified WKNavigation *)navigation {
    [self showHUD];
}

- (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation {
    [self hideHUD];
}


- (WKWebView *)webView {
    if (_webView == nil) {
        _webView = [[WKWebView alloc] init];
        _webView.backgroundColor = [UIColor clearColor];
        _webView.navigationDelegate = self;
        _webView.scrollView.delegate = self;
    }
    return _webView;
}

@end
